package com.hunt.service.impl;
import com.hunt.model.entity.BaseData;
import com.hunt.service.GetStockBasicService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class GetStockBasicServiceImpl implements GetStockBasicService {
    private static final Logger log = LoggerFactory.getLogger(GetStockBasicServiceImpl.class);
    private static final String table  = "basic_daily";
    @Autowired
    private MongoTemplate stockBaseMongoTemplate;
    @Override
    public List<BaseData> findByTsCode(String ts_code) {

        Query query = new Query(Criteria.where("ts_code").is(ts_code));
        return  stockBaseMongoTemplate.find(query, BaseData.class,table);
    }
}
